package com.techfort.testguice;

import java.util.List;

import roboguice.activity.RoboActivity;
import roboguice.inject.InjectView;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;

import com.techfort.testguice.db.BookmarkDAO;
import com.techfort.testguice.pojo.Bookmark;

public class Bookmarks extends RoboActivity {
	
	@InjectView(R.id.list) ListView list;
	BookmarkDAO dao;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.list);
		dao = new BookmarkDAO(this);
		List<Bookmark> bms = (List<Bookmark>) dao.getAll();
		Log.i("INFO", "Size of bms: " + bms.size());
		ManageItemsAdapter<Bookmark> mia = new ManageItemsAdapter<Bookmark>(this, R.layout.checkbox_row, R.id.title, bms);
		list.setAdapter(mia);
		
	}
	@Override
	protected void onDestroy() {
		try {
			dao.close();
		} catch(Exception e){
			
		}
		super.onDestroy();
	}
}
